<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCommissionTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('commission', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('from_member')->unsigned()->nullable()->comment('产生用户id');
			$table->integer('to_member')->unsigned()->nullable()->index('to_member')->comment('受益用户id');
			$table->decimal('price', 9)->nullable()->comment('金额');
			$table->boolean('type')->nullable()->comment('1.推广人返利2.团队管理提成.8.推广奖励');
			$table->text('desc', 65535)->nullable();
			$table->timestamps();
			$table->index(['from_member','to_member'], 'from_member');
			$table->index(['from_member','to_member'], 'from_member_2');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('commission');
	}

}
